from .models import *
from rest_framework import serializers


class DataPartcountViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = DataPartcount
        fields = [
            "timestamp",
            "endpointnum",
            "assetnum",
            "counttype",
            "data",
            "createdate",
        ]


class DataCycletimeViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = DataCycletime
        fields = [
            "timestamp",
            "endpointnum",
            "assetnum",
            "data",
            "overdata",
            "tag",
            "status",
            "createdate",
            "unloadtime",
            "loadtime",
            "total",
            "modifydate",
        ]


class DataFaultcodeViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = DataFaultcode
        fields = [
            "fault_id",
            "timestamp",
            "endpointnum",
            "assetnum",
            "data",
        ]


class DataMachinefaultViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = DataMachinefault
        fields = [
            "endpointnum",
            "assetnum",
            "faulttime",
            "andontime",
            "andon_acktime",
            "autotime",
            "duration",
            "createdate",
        ]


class DataShiftcountViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = DataShiftcount
        fields = [
            "timestamp",
            "endpointnum",
            "assetnum",
            "goodcount",
            "rejectcount",
            "shift",
            "day",
        ]


class DataTooldoortimeViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = DataTooldoortime
        fields = [
            "timestamp",
            "endpointnum",
            "assetnum",
            "data",
        ]


class SummaryCycletimeViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = SummaryCycletime
        fields = [
            "assetnum",
            "endpointnum",
            "day",
            "count1",
            "time1",
            "count2",
            "time2",
            "count3",
            "time3",
            "count4",
            "time4",
            "count5",
            "time5",
            "count6",
            "time6",
            "count7",
            "time7",
            "count8",
            "time8",
            "count9",
            "time9",
            "count10",
            "time10",
            "count11",
            "time11",
            "count12",
            "time12",
            "count13",
            "time13",
            "count14",
            "time14",
            "count15",
            "time15",
            "count16",
            "time16",
            "count17",
            "time17",
            "count18",
            "time18",
            "count19",
            "time19",
            "count20",
            "time20",
            "count21",
            "time21",
            "count22",
            "time22",
            "count23",
            "time23",
            "count24",
            "time24",
            "totalcount",
            "totaltime",
            "createby",
            "createdate",
            "modifyby",
            "modifydate",
        ]


class SummaryPartcountViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = SummaryPartcount
        fields = [
            "assetnum",
            "day",
            "goodcount1",
            "rejectcount1",
            "goodcount2",
            "rejectcount2",
            "goodcount3",
            "rejectcount3",
            "goodcount4",
            "rejectcount4",
            "goodcount5",
            "rejectcount5",
            "goodcount6",
            "rejectcount6",
            "goodcount7",
            "rejectcount7",
            "goodcount8",
            "rejectcount8",
            "goodcount9",
            "rejectcount9",
            "goodcount10",
            "rejectcount10",
            "goodcount11",
            "rejectcount11",
            "goodcount12",
            "rejectcount12",
            "goodcount13",
            "rejectcount13",
            "goodcount14",
            "rejectcount14",
            "goodcount15",
            "rejectcount15",
            "goodcount16",
            "rejectcount16",
            "goodcount17",
            "rejectcount17",
            "goodcount18",
            "rejectcount18",
            "goodcount19",
            "rejectcount19",
            "goodcount20",
            "rejectcount20",
            "goodcount21",
            "rejectcount21",
            "goodcount22",
            "rejectcount22",
            "goodcount23",
            "rejectcount23",
            "goodcount24",
            "rejectcount24",
            "goodtotal",
            "rejecttotal",
            "createby",
            "createdate",
            "modifyby",
            "modifydate",
        ]


class ToolChangTimeViewSerializer(serializers.ModelSerializer):
    class Meta:
        model = ToolChangTime
        fields = [
            "assetnum",
            "toolnumber",
            "starttime",
            "endtime",
            "duration",
            "location",
            "op",
            "old_maxlife",
            "new_maxlife",
            "old_actuallife",
            "new_actuallife",
            "old_restlife",
            "new_restlife",
            "old_blocknumber",
            "new_blocknumber",
            "createdate",
        ]
